<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of sylvester</title>
  <meta name="keywords" content="sylvester">
  <meta name="description" content="The Sylvester's criterion.">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html v1.5 &copy; 2003-2005 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../index.html">Home</a> &gt;  <a href="index.html">source</a> &gt; sylvester.m</div>

<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for source&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>-->

<h1>sylvester
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>The Sylvester's criterion.</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function bool = sylvester( A ) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment">The Sylvester's criterion.

This function check if the given matrix A is symmetric, definite positive, using the Sylvester's Criterion.

Prototype: bool = sylvester(A)

Input:     The A matrix to check.

Output:    It returns 1 (TRUE) if A is symmetric, definite positive.
           It returns 0 (FALSE) if A is NOT symmetric, definite positive.

Author: Esposito Gianluca (N.Matr.056/100858)
Revision Claudio Fantacci, Alessandro Martini.</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="robLySearch.html" class="code" title="function [] = robLySearch( A, m )">robLySearch</a>	Calculate the stability of a system whit Homogeneous Lyapunov function.</li></ul>
<!-- crossreference -->



<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre>0001 <span class="comment">%The Sylvester's criterion.</span>
0002 <span class="comment">%</span>
0003 <span class="comment">%This function check if the given matrix A is symmetric, definite positive, using the Sylvester's Criterion.</span>
0004 <span class="comment">%</span>
0005 <span class="comment">%Prototype: bool = sylvester(A)</span>
0006 <span class="comment">%</span>
0007 <span class="comment">%Input:     The A matrix to check.</span>
0008 <span class="comment">%</span>
0009 <span class="comment">%Output:    It returns 1 (TRUE) if A is symmetric, definite positive.</span>
0010 <span class="comment">%           It returns 0 (FALSE) if A is NOT symmetric, definite positive.</span>
0011 <span class="comment">%</span>
0012 <span class="comment">%Author: Esposito Gianluca (N.Matr.056/100858)</span>
0013 <span class="comment">%Revision Claudio Fantacci, Alessandro Martini.</span>
0014 
0015 <a name="_sub0" href="#_subfunctions" class="code">function bool = sylvester( A )</a>
0016 
0017 bool = -1;
0018 [row,col] = size(A);
0019 
0020 <span class="comment">%Is A a square matrix?</span>
0021 <span class="keyword">if</span> (row ~= col)
0022    fprintf(<span class="string">'Impossibile proseguire: matrice non quadrata\n'</span>);
0023    <span class="keyword">return</span>
0024 <span class="keyword">end</span>
0025 
0026 <span class="comment">%Is A symmetric?</span>
0027 At = A';
0028 <span class="keyword">for</span> i = 1 : row
0029    <span class="keyword">for</span> j = 1 : col
0030       <span class="keyword">if</span> (abs(At(i,j) - A(i,j)) &gt;= eps)
0031          fprintf(<span class="string">'Impossibile proseguire: matrice non simmetrica\n'</span>);
0032          <span class="keyword">return</span>
0033       <span class="keyword">end</span>
0034    <span class="keyword">end</span>
0035 <span class="keyword">end</span>
0036 
0037 <span class="comment">%The Sylvester's criterion</span>
0038 <span class="keyword">for</span> k = 1 : row
0039    <span class="keyword">if</span> (det(A(1:k,1:k)) &lt;= 0)
0040       bool = 0;
0041       <span class="keyword">return</span>
0042    <span class="keyword">end</span>
0043 <span class="keyword">end</span>
0044 bool = 1;</pre></div>
<hr><address>Generated on Mon 12-Oct-2009 21:15:56 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
</body>
</html>